# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Daniel Bermond <danielbermond@yahoo.com>

pkgname=ffnvcodec-headers8.1
pkgver=8.1.24.13
pkgrel=1
pkgdesc='FFmpeg version of headers required to interface with Nvidias codec APIs'
arch=(any)
url=https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git
license=(MIT)
makedepends=(git)
_tag=a80f80e2b65fa1e898ccd6464f24d66abb58238b
source=(
  git+https://git.videolan.org/git/ffmpeg/nv-codec-headers.git#tag=${_tag}
  ffnvcodec-install.patch
)
b2sums=('SKIP'
        '768036e308ad632ac99cb31eab2574a79d75baa834fb2781863a435530f4e6631cbb968c7b73442d67a72e8eba96fd4330d7f3c179f527546601c73126588c31')

pkgver() {
  cd nv-codec-headers
  git describe --tags | sed 's/^n//'
}

prepare() {
  cd nv-codec-headers
  patch -Np1 -i ../ffnvcodec-install.patch
}

build() {
  make PREFIX=/usr -C nv-codec-headers
  sed -n '4,25p' nv-codec-headers/include/ffnvcodec/nvEncodeAPI.h > LICENSE # Extract license
  sed -i '1,22s/^.\{,3\}//' LICENSE # Delete C comments
}

package() {
  make PREFIX=/usr DESTDIR="${pkgdir}" -C nv-codec-headers install
  install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/ffnvcodec-headers8.1/
}

# vim: ts=2 sw=2 et:
